-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CFI: Support complex receivers #123005
CFI: Support complex receivers #123005
Conversation
r? compiler-errors |
yeah my ability to say much pretty much dies above cg_ssa. |
e149471
to
c84586c
Compare
These commits modify the If this was unintentional then you should revert the changes before this PR is merged. |
This happened because moving the query into the mangler resulted in a new dep on |
I'll take another look in a few hours, since I'm on a run. The approach makes sense, but I'll probably leave some suggestions for comments for why it's correct. |
compiler/rustc_symbol_mangling/src/typeid/typeid_itanium_cxx_abi.rs
Outdated
Show resolved
Hide resolved
c84586c
to
bd30628
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few tweaks
compiler/rustc_symbol_mangling/src/typeid/typeid_itanium_cxx_abi.rs
Outdated
Show resolved
Hide resolved
compiler/rustc_symbol_mangling/src/typeid/typeid_itanium_cxx_abi.rs
Outdated
Show resolved
Hide resolved
compiler/rustc_symbol_mangling/src/typeid/typeid_itanium_cxx_abi.rs
Outdated
Show resolved
Hide resolved
bd30628
to
46d100b
Compare
compiler/rustc_symbol_mangling/src/typeid/typeid_itanium_cxx_abi.rs
Outdated
Show resolved
Hide resolved
compiler/rustc_symbol_mangling/src/typeid/typeid_itanium_cxx_abi.rs
Outdated
Show resolved
Hide resolved
46d100b
to
da32112
Compare
compiler/rustc_symbol_mangling/src/typeid/typeid_itanium_cxx_abi.rs
Outdated
Show resolved
Hide resolved
Previously, we only rewrote `&self` and `&mut self` receivers. By instantiating the method from the trait definition, we can make this work work with arbitrary legal receivers instead.
da32112
to
40f41e7
Compare
@bors r+ |
…compiler-errors CFI: Support complex receivers Right now, we only support rewriting `&self` and `&mut self` into `&dyn MyTrait` and `&mut dyn MyTrait`. This expands it to handle the full gamut of receivers by calculating the receiver based on *substitution* rather than based on a rewrite. This means that, for example, `Arc<Self>` will become `Arc<dyn MyTrait>` appropriately with this change. This approach also allows us to support associated type constraints as well, so we will correctly rewrite `&self` into `&dyn MyTrait<T=i32>`, for example. r? `@workingjubilee`
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#122802 (Provide structured suggestion for unconstrained generic constant) - rust-lang#122858 (Tweak `parse_dot_suffix_expr`) - rust-lang#122923 (In `pretty_print_type()`, print `async fn` futures' paths instead of spans.) - rust-lang#122990 (Clarify transmute example) - rust-lang#122995 (Clean up unnecessary headers/flags in coverage mir-opt tests) - rust-lang#123003 (CFI: Handle dyn with no principal) - rust-lang#123005 (CFI: Support complex receivers) - rust-lang#123020 (Temporarily remove nnethercote from the review rotation.) r? `@ghost` `@rustbot` modify labels: rollup
…compiler-errors CFI: Support complex receivers Right now, we only support rewriting `&self` and `&mut self` into `&dyn MyTrait` and `&mut dyn MyTrait`. This expands it to handle the full gamut of receivers by calculating the receiver based on *substitution* rather than based on a rewrite. This means that, for example, `Arc<Self>` will become `Arc<dyn MyTrait>` appropriately with this change. This approach also allows us to support associated type constraints as well, so we will correctly rewrite `&self` into `&dyn MyTrait<T=i32>`, for example. r? ``@workingjubilee``
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#120557 (Add rust-lldb pretty printing for Path and PathBuf) - rust-lang#122802 (Provide structured suggestion for unconstrained generic constant) - rust-lang#122858 (Tweak `parse_dot_suffix_expr`) - rust-lang#122990 (Clarify transmute example) - rust-lang#122995 (Clean up unnecessary headers/flags in coverage mir-opt tests) - rust-lang#123003 (CFI: Handle dyn with no principal) - rust-lang#123005 (CFI: Support complex receivers) - rust-lang#123020 (Temporarily remove nnethercote from the review rotation.) r? `@ghost` `@rustbot` modify labels: rollup
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#120557 (Add rust-lldb pretty printing for Path and PathBuf) - rust-lang#122802 (Provide structured suggestion for unconstrained generic constant) - rust-lang#122858 (Tweak `parse_dot_suffix_expr`) - rust-lang#122990 (Clarify transmute example) - rust-lang#122995 (Clean up unnecessary headers/flags in coverage mir-opt tests) - rust-lang#123003 (CFI: Handle dyn with no principal) - rust-lang#123005 (CFI: Support complex receivers) - rust-lang#123020 (Temporarily remove nnethercote from the review rotation.) r? `@ghost` `@rustbot` modify labels: rollup
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#122858 (Tweak `parse_dot_suffix_expr`) - rust-lang#122982 (Add more comments to the bootstrap code that handles `tests/coverage`) - rust-lang#122990 (Clarify transmute example) - rust-lang#122995 (Clean up unnecessary headers/flags in coverage mir-opt tests) - rust-lang#123003 (CFI: Handle dyn with no principal) - rust-lang#123005 (CFI: Support complex receivers) - rust-lang#123020 (Temporarily remove nnethercote from the review rotation.) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#123005 - maurer:cfi-arbitrary-receivers, r=compiler-errors CFI: Support complex receivers Right now, we only support rewriting `&self` and `&mut self` into `&dyn MyTrait` and `&mut dyn MyTrait`. This expands it to handle the full gamut of receivers by calculating the receiver based on *substitution* rather than based on a rewrite. This means that, for example, `Arc<Self>` will become `Arc<dyn MyTrait>` appropriately with this change. This approach also allows us to support associated type constraints as well, so we will correctly rewrite `&self` into `&dyn MyTrait<T=i32>`, for example. r? ```@workingjubilee```
…, r=oli-obk Don't elaborate associated types with Sized bounds in `trait_object_ty` in cfi The elaboration mechanism introduced in rust-lang#123005 didn't filter for associated types with `Self: Sized` bounds, which since rust-lang#112319 has excluded them from the object type. Fixes rust-lang#127881 cc `@maurer` `@rcvalle`
Rollup merge of rust-lang#127882 - compiler-errors:cfi-sized-self-gat, r=oli-obk Don't elaborate associated types with Sized bounds in `trait_object_ty` in cfi The elaboration mechanism introduced in rust-lang#123005 didn't filter for associated types with `Self: Sized` bounds, which since rust-lang#112319 has excluded them from the object type. Fixes rust-lang#127881 cc `@maurer` `@rcvalle`
Right now, we only support rewriting
&self
and&mut self
into&dyn MyTrait
and&mut dyn MyTrait
. This expands it to handle the full gamut of receivers by calculating the receiver based on substitution rather than based on a rewrite. This means that, for example,Arc<Self>
will becomeArc<dyn MyTrait>
appropriately with this change.This approach also allows us to support associated type constraints as well, so we will correctly rewrite
&self
into&dyn MyTrait<T=i32>
, for example.r? @workingjubilee